package com.zzyl.common.core.page;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 表格分页数据对象
 *
 * @Author: zzyl
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "响应信息")
public class TableDataInfo<T> implements Serializable {
	private static final long serialVersionUID = 1L;

	/** 总记录数 */
	@ApiModelProperty(value = "总记录数", required = true)
	private long total;

	/** 列表数据 */
	@ApiModelProperty(value = "列表数据", required = true)
	private List<T> rows;

	/** 消息状态码 */
	@ApiModelProperty(value = "消息状态码", example = "200", required = true)
	private int code;

	/** 消息内容 */
	@ApiModelProperty(value = "消息内容", required = true)
	private String msg;

	/**
	 * 分页
	 *
	 * @param list  列表数据
	 * @param total 总记录数
	 */
	public TableDataInfo(List<T> list, int total) {
		this.rows = list;
		this.total = total;
	}

}
